//package com.cjl.demo.thread;
//
//import org.apache.commons.logging.Log;
//import org.apache.commons.logging.LogFactory;
//
//import java.util.concurrent.*;
//
///**
// * <p>Copyright: All Rights Reserved</p>
// * <p>Description: </p>
// *
// * @ uthor chenjinliang
// * @ date: 2020/2/23
// */
//public class TaskExecuteHelper {
//    static Log logger = LogFactory.getLog(TaskExecuteHelper.class);
//
//    /**
//     * 核心线程
//     */
//    public static final int COREPOOL_SIZE = 8;
//
//    /**
//     * 最大线程
//     */
//    public static final int MAXIMUMPOOL_SIZE = 32;
//
//    /**
//     * 线程池等待时间
//     */
//    public static final long KEEPALIVE_TIME = 50L;
//
//    /**
//     * 拒绝策略：由调用线程处理该任务
//     * 目前处理的任务：
//     * 1.ESB 接收消息
//     */
//    public static final ExecutorService esb_receiver_executor = new ThreadPoo                                                                                                                                                       lExecutor(COREPOOL_SIZE, MAXIMUMPOOL_SIZE, KEEPALIVE_TIME,
//            TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(5000), Executors.defaultThreadFactory(), new ThreadPoolExecutor.CallerRunsPolicy());
//
//
//    public static ThreadPoolExecutor send_esb_executor = new ThreadPoolExecutor(COREPOOL_SIZE,MAXIMUMPOOL_SIZE,KEEPALIVE_TIME,
//            TimeUnit.SECONDS,new ArrayBlockingQueue<>(50000),new ThreadPoolExecutor.AbortPolicy());
//
//    /**
//     * 拒绝策略：使用抛出异常的形式 RejectedExecutionException
//     * 目前处理的任务：
//     * 1.ESB 接收消息
//     */
//    public static final ExecutorService retryUpdateImMsgInfo_executor = new ThreadPoolExecutor(COREPOOL_SIZE, MAXIMUMPOOL_SIZE, KEEPALIVE_TIME,
//            TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(5000), Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
//
//    /**
//     * 拒绝策略：由调用线程处理该任务
//     * 目前处理的任务：
//     * 1.定时执行的统计任务
//     */
//    public static final ExecutorService filterUnReaderMsgJob_executor = new ThreadPoolExecutor(COREPOOL_SIZE, MAXIMUMPOOL_SIZE, KEEPALIVE_TIME,
//            TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(5000), Executors.defaultThreadFactory(), new ThreadPoolExecutor.CallerRunsPolicy());
//
//    /**
//     * 拒绝策略：使用抛出异常的形式 RejectedExecutionException
//     * 目前处理的任务：
//     * 1.ESB 接收消息
//     */
//    public static volatile ExecutorService EXECUTOR_SERVICE_LAZY = null;
//
//    /**
//     * 执行 用户信息保存redis 信息
//     */
//    public static final ExecutorService SINGLE_EXECUTOR = Executors.newSingleThreadExecutor();
//
//    public static ExecutorService getExecutorServiceLazy() {
//        if(EXECUTOR_SERVICE_LAZY == null){
//            synchronized (TaskExecuteHelper.class){
//                if(EXECUTOR_SERVICE_LAZY == null){
//                    EXECUTOR_SERVICE_LAZY = new ThreadPoolExecutor(4, 8, KEEPALIVE_TIME,
//                            TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(), Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
//                }
//            }
//        }
//        return EXECUTOR_SERVICE_LAZY;
//    }
//}
